/*
 * @Author: 高瑞寒 15932717091@163.com
 * @Date: 2022-05-07 14:23:22
 * @LastEditTime: 2022-05-07 14:51:12
 * @LastEditors: 高瑞寒 15932717091@163.com
 * @Description: 
 */
import React, { Component } from 'react'

export default class Parent extends Component {
  state = {
    isError: ''
  }
  static getDerivedStateFromError(error) {
    console.log('@@',error);
    return {
      isError: error
    }
  }
  render() {
    console.log(this.state.isError);
    return (
      <div>我是父组件
        {this.state.isError ? '错误' : <Child></Child>}
      </div>
    )
  }
}
class Child extends Component {
  state={
    arr:''
  }
  render() {
    return (
      <div>{this.state.arr.map(()=><div>你个嗨</div>)}</div>
    )
  }
}
